﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using DLL;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected string sInform = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        //获取用户登陆信息
        if (Session["landInfo"] != null)
        {
            landInfo landInfo = (landInfo)Session["landInfo"];
            Page.RegisterStartupScript("welcome", "<script type='text/javascript' language='javascript'>document.getElementById('divWelcome').innerHTML='您好" + landInfo.UserName + "，欢迎使用本系统！'</script>");
        }
        //加载首页数据
        if (!IsPostBack)
        {
            LoadGG();
        }
    }
    private void LoadGG()
    {
        //获取公告
        GridView gvGG = new GridView();
        gvGG.DataSource = gg_BLL.GetGGSource();
        gvGG.DataBind();

        //取出公告数据以便在首页显示
        foreach (GridViewRow row in gvGG.Rows)
        {
            sInform += "<table style='width:100%;line-height:20px;'><tr><td style='text-align:center;color:blue;font-size:13px;'><b>" + row.Cells[1].Text + "</b></td></tr>";
            sInform += "<tr><td><b>内容：</b>" + row.Cells[2].Text + "</td></tr>";
            sInform += "<tr><td><b>日期：</b>" + row.Cells[3].Text + "</td></tr></table></br>";
        }
        //获取试卷前10条
        gvTop10Exam.DataSource = examDesign_BLL.GetTopNPaper(10);
        gvTop10Exam.DataBind();
    }
}
